package com.linkage.jz.bankruptcy.bean;


import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author AFAP
 * 任务附件
 */
public class TaskAtta  implements Serializable {
    /**
     * id : 1
     * bankruptcyProjectId : 9c208e41eab641d59b88372c986605e9
     * taskId : ec26d67883dc4698bd5bcbd9c47675c2
     * attachmentName : 任务附件1
     * attachmentSuffix : jpg
     * attachmentPreviewAddress : null
     * attachmentDownloadAddress : null
     * attachmentWatermarkAddress : http://60.205.186.115:8001/group1/M00/00/04/rBHd5Fya1PmACFKoAAA7GwNBo1Q524-wmark.jpg?token=f7a812c06e98190008e30ab3d545743b&ts=1555296297
     * attachmentThumbnailAddress : null
     * attachmentSize : 123
     * canDelete : false
     * opBy : null
     * opAt : null
     * delFlag : false
     */

    private String id;
    private String bankruptcyProjectId;
    private String taskId;
    private String attachmentName;
    private String attachmentSuffix;
    private String attachmentPreviewAddress;
    private String attachmentDownloadAddress;
    private String attachmentWatermarkAddress;
    private String attachmentThumbnailAddress;
    private int attachmentSize;
    private boolean canDelete;
    private String opBy;
    private long opAt;
    private boolean delFlag;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getBankruptcyProjectId() {
        return bankruptcyProjectId;
    }

    public void setBankruptcyProjectId(String bankruptcyProjectId) {
        this.bankruptcyProjectId = bankruptcyProjectId;
    }

    public String getTaskId() {
        return taskId;
    }

    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }

    public String getAttachmentName() {
        return attachmentName;
    }

    public void setAttachmentName(String attachmentName) {
        this.attachmentName = attachmentName;
    }

    public String getAttachmentSuffix() {
        return attachmentSuffix;
    }

    public void setAttachmentSuffix(String attachmentSuffix) {
        this.attachmentSuffix = attachmentSuffix;
    }

    public String getAttachmentPreviewAddress() {
        return attachmentPreviewAddress;
    }

    public void setAttachmentPreviewAddress(String attachmentPreviewAddress) {
        this.attachmentPreviewAddress = attachmentPreviewAddress;
    }

    public String getAttachmentDownloadAddress() {
        return attachmentDownloadAddress;
    }

    public void setAttachmentDownloadAddress(String attachmentDownloadAddress) {
        this.attachmentDownloadAddress = attachmentDownloadAddress;
    }

//    public String getAttachmentDowloadAddress() {
//        return attachmentDownloadAddress;
//    }

    public String getAttachmentWatermarkAddress() {
        return attachmentWatermarkAddress;
    }

    public void setAttachmentWatermarkAddress(String attachmentWatermarkAddress) {
        this.attachmentWatermarkAddress = attachmentWatermarkAddress;
    }

    public String getAttachmentThumbnailAddress() {
        return attachmentThumbnailAddress;
    }

    public void setAttachmentThumbnailAddress(String attachmentThumbnailAddress) {
        this.attachmentThumbnailAddress = attachmentThumbnailAddress;
    }

    public int getAttachmentSize() {
        return attachmentSize;
    }

    public void setAttachmentSize(int attachmentSize) {
        this.attachmentSize = attachmentSize;
    }

    public boolean isCanDelete() {
        return canDelete;
    }

    public void setCanDelete(boolean canDelete) {
        this.canDelete = canDelete;
    }

    public String getOpBy() {
        return opBy;
    }

    public void setOpBy(String opBy) {
        this.opBy = opBy;
    }

    public long getOpAt() {
        return opAt;
    }

    public void setOpAt(long opAt) {
        this.opAt = opAt;
    }

    public boolean isDelFlag() {
        return delFlag;
    }

    public void setDelFlag(boolean delFlag) {
        this.delFlag = delFlag;
    }

    public static List<TaskAtta> parse(JsonArray arr) {
        List<TaskAtta> list = new ArrayList<>();
        for (int i = 0; i < arr.size(); i++) {
            list.add(parse(arr.get(i).getAsJsonObject()));
        }
        return list;
    }

    private static TaskAtta parse(JsonObject obj) {
        TaskAtta bean = new Gson().fromJson(obj, TaskAtta.class);
        return bean;
    }
}
